package com.mayfool.task.entity;

import jakarta.persistence.*;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.util.Date;

/**
 * @author zhou.xu
 * @since 2024/8/31 22:07
 */
@Data
@Entity
@EntityListeners({AuditingEntityListener.class})
@Table(indexes = {
        @Index(name = "idx_url", columnList = "url", unique = true)
})
public class Credential {

    @Id
    @GeneratedValue
    private Long id;

    /**
     * 仓库地址
     */
    @Column(nullable = false)
    private String url;

    /**
     * 用户名
     */
    private String username;

    /**
     * 密码
     */
    private String password;

    /**
     * 令牌
     */
    private String token;

    /**
     * 创建时间
     */
    @CreatedDate
    private Date createTime;

    /**
     * 更新时间
     */
    @LastModifiedDate
    private Date updateTime;
}
